﻿@model Products.Databases.Field
@{
    var currentVersions = (IList<Products.ProductVersion>)ViewData["Versions"];
    ViewBag.Title = "New Change for field " + this.Model.Name;
    Layout = "~/Views/Shared/App.cshtml";
}
<script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>
@using (Html.BeginForm())
{
    
    @Html.ValidationSummary(true)
    
    <div class="cssform">
        <p>
            <label for="deletedCheckBox">
                Deleted</label>
            <input type="checkbox" id="deletedCheckBox" value="deleted" name="deletedCheckBox" />
        </p>
        <div id="editPanel">
            <p>
                @Html.LabelFor(model => model.Name)
                @Html.EditorFor(model => model.Name)
                @Html.ValidationMessageFor(model => model.Name)
            </p>
            <p>
                @Html.LabelFor(model => model.SqlType)
                @Html.EditorFor(model => model.SqlType)
                @Html.ValidationMessageFor(model => model.SqlType)
            </p>
            <p>
                @Html.LabelFor(model => model.Length)
                @Html.EditorFor(model => model.Length)
                @Html.ValidationMessageFor(model => model.Length)
            </p>
            <p>
                @Html.LabelFor(model => model.Memo)
                @Html.TextAreaFor(model => model.Memo)
                @Html.ValidationMessageFor(model => model.Memo)
            </p>
            <p>
                <label>
                    Versions:</label>
                <select name="versionId" id="versions">
                    @foreach (var v in currentVersions)
                    {
                        <option value="@v.Id">@v.Name</option>
                    }
                </select>
            </p>
            <p>
                <input type="submit" value="Create" />
            </p>
        </div>
    </div>
}
<div>
    @Html.ActionLink("Back to List", "Index")
</div>
@section Header{
    <script type="text/javascript">
        $(document).ready(function () {
            $("#deletedCheckBox").change(function () {
                $("#editPanel input[type!=submit],#editPanel textarea").attr("disabled", this.checked);
            });
        });
    </script>
}
@section PageTitle{
}
